home *** CD-ROM | disk | FTP | other *** search
- Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
- From: grantp@usa.pipeline.com(Pete Grant)
- Newsgroups: comp.lang.c++
- Subject: Re: Problems passing Device Context handels from VB 4.0 to VC++2.0 DLLÆs
- Date: 17 Apr 1996 11:21:58 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4l2k8m$f35@news1.h1.usa.pipeline.com>
- References: <4l2bbd$mto@gidora.kralizec.net.au>
- NNTP-Posting-Host: 38.8.120.10
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete Grant)
- X-Newsreader: Pipeline v3.5.0
-
- On Apr 17, 1996 07:49:27 in article <Problems passing Device Context
- handels from VB 4.0 to VC++2.0 DLLÆs>, 'srsawyer@zeta.org.au (Stephen
- Sawyer)' wrote:
-
-
- >If anyone has has any experiance in writing VC++ DLLs and passing
- >Device Context handels from VB 4.0, I would realy appresiate your
- >help. I am trying to sent a Device Context handel from VB 4.0 to a
- >VC++ 2.0 custom DLL but as you can see from my debugger watch values,
- >I do not receive a proper Device Context (hDC) in my VC++ DLL and the
- >result is my DLL crashes. However I can call the same DLL from a test
- >program in VC++ and it works correctly.
- >
- >My VB calling procedure declaration is of the form
- >
- > Declare Function MyPassHDC Lib "MyDll.dll" (ByVal hdc As Long) As
- >Integer
- >
- >and my C++ receiving declaration is
- >
- > int pascal MyPassHDC(CDC* hDC)
- ^^^^^^^^^^^
- CDC is a C++ class. You are telling the compiler that
- you are passing a pointer to a C++ class instance, which
- is not true. If you want to pass a device context handle,
- then declare it as MyPassHDC(HDC hDC);
-
- [... rest of code/debugger output deleted ...]
- --
- Pete Grant
- Kalevi, Inc.
- Software Engineering & development
-